-
Notifications
You must be signed in to change notification settings - Fork 10.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Abstract away the TestServer dependency from WebApplicationBuilder #60247
Conversation
8cf15f6
to
9c0fb14
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot reviewed 5 out of 12 changed files in this pull request and generated no comments.
Files not reviewed (7)
- src/Hosting/TestHost/src/PublicAPI.Unshipped.txt: Language not supported
- src/Mvc/Mvc.Testing/src/PublicAPI.Unshipped.txt: Language not supported
- src/Mvc/Mvc.Testing/src/Resources.resx: Language not supported
- src/Mvc/test/Mvc.FunctionalTests/ApiExplorerTest.cs: Evaluated as low risk
- src/Mvc/test/Mvc.FunctionalTests/Infrastructure/MvcTestFixture.cs: Evaluated as low risk
- src/Identity/test/Identity.FunctionalTests/Infrastructure/ServerFactory.cs: Evaluated as low risk
- src/Mvc/test/Mvc.FunctionalTests/ComponentRenderingFunctionalTests.cs: Evaluated as low risk
Comments suppressed due to low confidence (1)
src/Mvc/Mvc.Testing/src/WebApplicationFactory.cs:161
- [nitpick] The method name 'Initialize' might be too generic. Consider renaming it to 'InitializeServer' for better clarity.
public void Initialize()
Still battling the issue introduced by the relative contentRoot change. |
@mkArtakMSFT We'll need to do an API review for this since it includes a changes to the WAF interface. Have you had the chance to use these changes with a Playwright-based setup? |
e5aff71
to
bfa3c20
Compare
Will do! |
…ency with from in the WebApplicationFactory. - Updated the WebApplicationFactory to depend on the ITestServer abstraction
- Fixed the public API declarations - React to changes in the WebApplicationFactory - Use solution-relative contentRoot path, when the path from metadata either is not available or doesn't exist. - If none of the paths exist, use the AppContext.BaseDirectory instead. - Fix tests with outdated expectations
bfa3c20
to
1f62155
Compare
I have discovered an issue where the ITestServer creation happens through two different flows. I'm looking into whether this needs to be unified or not. Will update the PR once that's cleared. |
c0a16cc
to
1f62155
Compare
…er as obsolete and introduce a new CreateTestServer method.
Closing as we will be taking the alternative approach provided via #60635 |
- Added `UseKestrel(...)` APIs to the WebApplicationFactory<T> type. The API configures the WAF, so that later during initialization it will use Kestrel, instead of a TestServer for WebHostBuilder-based applications. - Two different overloads (described in the API Proposal #60758) are added - Renamed the `EnsureServer()` private method to `StartServer()` and made it public, so that consumers can call it directly, without the need of creating a client, as in many situations customers didn't need a client to interact with. This is an alternative design to enabling real server usage with WebApplicationFactory, which was considered here: #60247 Fixes #4892
Description
Validation
How do I know if this change didn't break something? Well, at first it did and many integration tests in the repo started failing. So these, naturally become a validation ground for this change.
Fixes #4892